#include "bps.h"
#include "rectype.h"
#include "util.h"
#include "cnfield.h"

using namespace std;
using namespace opsrc::stdf;

Bps::Bps()
{
}

Bps::Bps(stdf_rec _stdfrec, int _reclen, std::ios::pos_type _fileRecFirstBytePosition, int _orderindex, endian e, char* buf )
    :RecBase(_stdfrec, _reclen, _fileRecFirstBytePosition, _orderindex),en(e) {
    if (buf != 0)
        readFields(buf);
}

Bps::~Bps() {
}

const StdfField<string> Bps::getSequenceName() const {
    return seq_nam;
}

void Bps::setSequenceName(StdfField<string> seqnam) {
    seq_nam = seqnam;
}


void Bps::readFields(char *buf) {
#if _DEBUG
    //    cout << "stdfrec= BPS , filebytestartposition= " <<   getFileRecByteStartPosition() << ", databytecount= " << reclen <<endl;
    //    this->print(cout);
#endif
    int curpos = 0;
    // Read sequence name
    CnField<string> seqnam(buf+curpos, en);
    seq_nam.set(seqnam.getData(), curpos, seqnam.getByteCount(), seqnam.getTotalByteCount());
    cout << seq_nam.getData() << endl;
    cout << "\n\nBPS: OrderIndex: ------------"<< orderIndex << endl;
}
